package com.xlh.server.protocol.support.json;

import android.content.Context;

import com.xlh.Utils.GsonManager;
import com.xlh.bean.ProtocolObject.Oncmd;

import com.xlh.interf.IActivity;
import com.xlh.interf.ITakeMessage;


/**
 * Created by Administrator on 2018/7/2.
 */

public class OncmdServer implements ITakeMessage {

    private IActivity atv;
    private String hasType = "oncmds";
    private Oncmd protccoObj;
    public OncmdServer(IActivity atv){
        this.atv = atv;


    }

    @Override
    public void takeMessage(String t,String s){

        if(!t.equals(this.hasType)) return;

        protccoObj =  GsonManager.gsmgr.jsonToAnyObject(s, Oncmd.class);

        if(protccoObj==null || protccoObj.getCmd().equals("")) return;
        this.atv.getActivity().getmSocketClient().sendMsg(protccoObj.getCmd());

    }

    @Override
    public boolean takeMessage(String s) {
        return false;
    }

    @Override
    public void init() {

    }

    @Override
    public void atViewLoadAfterInit() {

    }

}
